﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace Sharpmark.MarkTweet.Services.Twitter
{
    [CollectionDataContract(Name = "direct-messages", ItemName = "direct_message", Namespace = "")]
    public class DirectMessages : List<DirectMessage> { }

    [DataContract(Name = "direct_message", Namespace = "")]
    public class DirectMessage
    {
        [DataMember(Name = "id")]
        public string Id { get; set; }

        [DataMember(Name = "text")]
        public string Text { get; set; }

        public DateTime CreatedAt { get; set; }
        [DataMember(Name = "created_at")]
        private string CreatedAtRaw
        {
            get { return CreatedAt.ToRowString(); }
            set { CreatedAt = value.ToDateTime(); }
        }

        [DataMember(Name = "sender_id")]
        public string SenderId { get; set; }

        [DataMember(Name = "recipient_id")]
        public string RecipientId { get; set; }

        [DataMember(Name = "sender_screen_name")]
        public string SenderScreenName { get; set; }

        [DataMember(Name = "recipient_screen_name")]
        public string RecipientScreenName { get; set; }

        [DataMember(Name = "sender")]
        public User Sender { get; set; }

        [DataMember(Name = "recipient")]
        public User Recipient { get; set; }
    }
}